#include<stdio.h>
int fun(int n)
{
    int a, b, c;
    if(n == 1) return 1;
    else if(n == 2) return 2;
    else
    {
        a = 1, b = 2;
        for(int i = 3; i <= n; i ++)
        {
            c = a + b; 
            a = b;
            b = c;
        }
        return c;
    }
}
int main()
{
    int n, count;
    while(scanf("%d", &n), n != 0)
    {
        count = fun(n);
        printf("%d\n", count);
    }

    return 0;
}